﻿using UnityEngine;
using System.Collections;

namespace PlayTest {
	public class Main : MonoBehaviour {
		int[,] map = new int[, ]{
			{0, 0, 0, 0, 13, 5, 1, 7, 13, 0, 0, 0, 0},
			{0, 32, 0, 0, 0, 6, 9, 8, 0, 0, 0, 0, 0},
			{0, 0, 0, 4, 12, 12, 3, 12, 12, 4, 14, 0, 0},
			{0, 0, 4, 4, 12, 12, 14, 12, 12, 4, 4, 33, 0},
			{33, 4, 4, 4, 11, 11, 10, 11, 11, 4, 4, 4, 0},
			{11, 0, 0, 0, 10, 10, 0, 10, 0, 0, 10, 0, 11},
			{15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
			{0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0},
			{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
			{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
			{0, 0, 33, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0},
			{0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0},
			{33, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0}
		};
		
		// Use this for initialization
		void Start () {
			// int w = Common.w_;
			// int h = Common.h_;
			// int gridWidth = w / 13;

			Config cfg = new Config ();

				
			for (int i = 0; i < 13; i++) {
				for (int j = 0; j < 13; j++) {
					Instantiate (Resources.Load("prefab/blank"),
					             new Vector3 ((j + 1) * 2 - 1,
					             (i + 1) * 2 - 1, 0),
					             Quaternion.identity
					             );

					Instantiate (Resources.Load("prefab/" + cfg.codeToName(map[i, j])),
						new Vector3 ((j + 1) * 2 - 1,
					    (i + 1) * 2 - 1, 0),
					    Quaternion.identity
					);
				}
			}
		}
		
		// Update is called once per frame
		void Update () {
			
		}
	}
}